package com.woniu.userservice.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @Auther: 李浪  <br/>
 * @Date: 2020/3/24:18:41  <br/>
 * @Description:Swagger2配置文件
 */
@Configuration
public class Swagger2Config {
	/**
	 * Description : TODO  初始化创建Swagger Api<br/>
	 * ChangeLog : 1. 创建 (2020/2/14 10:13 [李浪]); <br/>
	 * Auther: 李浪  <br/>
	 * Date: 2020/2/14:10:13  <br/>
	 *
	 * @return springfox.documentation.spring.web.plugins.Docket
	*/
	/**
	 * Description : TODO  初始化创建Swagger Api<br/>
	 * ChangeLog : 1. 创建 (2020/3/24 18:40 [李浪]);
	 * @return null
	*/
	@Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .pathMapping("/")
                .select()
                .paths(PathSelectors.regex("/.*"))
                .build();
    }
	/**
	 * Description : TODO  添加摘要信息<br/>
	 * ChangeLog : 1. 创建 (2020/3/24 18:40 [李浪]);
	 * @return null
	*/
    private ApiInfo apiInfo(){
        return new ApiInfoBuilder().title("考试培训系统接口文档")//接口文档的title
                //.contact(new Contact("www","","admin@qq.com"))
				.title("考试培训系统系统")
				.version("1.0")
                .description("接口文档描述")//接口文档的描述
                .build();
    }

}